package com.thesharegame.dal.dao;

import com.thesharegame.model.Market;
import com.thesharegame.model.Portfolio;
import com.thesharegame.model.Stock;
import com.thesharegame.model.User;

public class DAOFactory {

	private static DAOFactory INSTANCE;
	
	private DAOFactory(){
		
	}
	
	public static DAOFactory getInstance(){
		if(INSTANCE == null){
			INSTANCE = new DAOFactory();
		}
		return INSTANCE;
	}
	
	public DataAccessObject<?> getDAO(Object object){
		if(object instanceof User){
			return new UserDAO();
		}else if(object instanceof Portfolio){
			return new PortfolioDAO();
		}else if(object instanceof Market){
			return new MarketDAO();
		}else if(object instanceof Stock){
			return new StockDAO();
		}
		
		return null;
	}
}
